home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c / 729 < prev    next >
Text File  |  1996-08-06  |  1KB  |  42 lines

  1. Path: solon.com!not-for-mail
  2. From: Ari Lukumies <aril@cmt.lpr.mail.carel.fi>
  3. Newsgroups: comp.std.c,comp.lang.c.moderated
  4. Subject: Re: printf() format extensions - looking for beta testers...
  5. Date: 12 Apr 1996 07:30:15 -0500
  6. Organization: Carelcomp Products
  7. Sender: clc@solutions.solon.com
  8. Approved: clc@solutions.solon.com
  9. Message-ID: <4klicn$ndl@solutions.solon.com>
  10. References: <4kgljv$l2p@solutions.solon.com>
  11. NNTP-Posting-Host: solutions.solon.com
  12. X-Mailer: Mozilla 2.0 (WinNT; I)
  13.  
  14. Peter Seebach wrote:
  15.  > 
  16.  > 
  17.  > The basic idea of the proposed feature is that users would be able to install
  18.  > new formats; for instance, the user would
  19.  > do something like
  20.  >         int bangcvt(va_list *ap, char *s, int len, fmtspec *f) {
  21.  >                 strncpy(s, strerror(errno), len);
  22.  >                 s[len - 1] = '\0';
  23.  >                 return strlen(s);
  24.  >         }
  25.  > 
  26.  >         main() {
  27.  >                 format('!', bangcvt);
  28.  > 
  29.  >                 /* do something which can generate an error */
  30.  >                 fprintf(stderr, "%s: %!\n", "open failed");
  31.  >         }
  32.  
  33. Given the above, how about calls like (well, not a pretty one, but you get the 
  34. idea...):
  35.  
  36.     fprintf(stderr, "%-*.2!", something);
  37.  
  38. Later,
  39.  AriL
  40. -- 
  41. All my opinions are mine and mine alone.
  42.